package pl.enigmatic.time;

import pl.enigmatic.util.Metrics;


public class TimeCounterFloat {

	private final TimeCounterLong longCounter;
	private final float factor;

	public TimeCounterFloat(final boolean nano) {
		if (nano) {
			longCounter = new TimeCounterNano();
			factor = (float) Metrics.NANO;
		} else {
			longCounter = new TimeCounterMilli();
			factor = (float) Metrics.MILLI;
		}
	}

	public TimeCounterFloat() {
		this(true);
	}

	public float restart() {
		return factor * longCounter.restart();
	}

	/**
	 * @return
	 * @see pl.enigmatic.time.TimeCounterLong#getMeasuredTime()
	 */
	public float getMeasuredTime() {
		return factor * longCounter.getMeasuredTime();
	}

	/**
	 * @return
	 * @see pl.enigmatic.time.TimeCounterLong#getElapsedTime()
	 */
	public float getElapsedTime() {
		return factor * longCounter.getElapsedTime();
	}

	public float getDelta() {
		return factor * longCounter.getDelta();
	}
}
